package com.tdf.webblog.api;

import com.tdf.webblog.dto.UserDTO;
import com.tdf.webblog.entity.AdminMenu;
import com.tdf.webblog.entity.AdminPermission;
import com.tdf.webblog.entity.AdminRole;
import com.tdf.webblog.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

@FeignClient("WebBlog-mysql-provider")
public interface MySQLRemoteService {

    @RequestMapping("/find/by/username/remote")
    public User findByUsernameRemote(@RequestParam("username") String username);

    @RequestMapping("/listpermissionurls/by/user/remote")
    Set<String> listPermissionURLsByUserRemote(@RequestParam("username") String username);

    @RequestMapping("/find/all/remote")
    List<AdminPermission> findAllRemote();

    @GetMapping("/getmenus/by/currentuser/remote")
    List<AdminMenu> getMenusByCurrentUserRemote(@RequestParam("username") String username);

    @RequestMapping("/list/remote")
    List<UserDTO> listRemote();

    @PostMapping("/save/user/remote")
    int saveUserRemote(@RequestBody User user);

    @GetMapping("/list/with/perms/and/menus/remote")
    List<AdminRole> listWithPermsAndMenusRemote();

    @GetMapping("/get/menus/by/roleid/remote")
    List<AdminMenu> getMenusByRoleIdRemote(@RequestParam("rid") int rid);

    @GetMapping("/admin/role/perm")
    List<AdminPermission> listAdminPermissionRemote();
}
